import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== Declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const $cache = $Lazy.file(()=>import('#private/cache-api'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		rows:{},
		// 提交表单列表
		formData : [
			{ label: '分公司',	name: 'comp_id', 	full:true, 	required:true, 	type: 'select',	loading: true },
			{ label: '标箱条码',	name: 'box_code', 	full:true, 	required:true },
		]
	}
	
	submit = {}
	
	open = rows => {
		this.submit = {uuid: rows}
		this.modal.open()
		this.getModalSelect()
	}
	// 获取弹框下拉
	getModalSelect = async () => {
		const { formData } = this.state
		$cache.then( async f => {
			const { query:{ project_id } } = this.props
			// 分公司
			$fn.setRow(formData, 'comp_id', await f.getCache({ api: 'lis-outsourcing-map/vendor', param:{project_id} }))
			this.setState({ formData })
		})
	}
	
	render(){
		return FormModal.call(this,{ title:'集团内转外包', labelWidth:'s5', width:600, api:'ts-report-card/innerOutsourcing', isConfirm:true})
	}
}

export default Index